#include "ALLMenu.h"
#include "Show.h"
#include "Archive.h"

LoadMenu::LoadMenu(IMenu *FM) {
	FatherMenu = FM;
	NextMenu = new PlayMenu01(this);
}

LoadMenu::~LoadMenu() {
	delete NextMenu;
}

bool LoadMenu::process() {
	int opt = -1;
	while(opt == -1) {
		Show show(this);
		show.Archive();
		Choose chs;
		opt = chs.Option(this, Archives::getInstance().total() + 1);
	}
	if(opt != 0) {
		NextMenu->SetValue(Archives::getInstance().getArchiveVal(opt - 1));
		MenuMgr::getInstance().SetActiveMenu(NextMenu);
//		std::cout << Archives::getInstance().getArchiveVal(opt - 1);
//		std::cin >> opt;
	} else {
		MenuMgr::getInstance().SetActiveMenu(FatherMenu);
	}
	return !OVER;
}

std::string LoadMenu::GetChildName(int k) {
	if(k > 1) {
		return Archives::getInstance().getArchiveName(k - 1);
	} 
	return "Back";
}

int LoadMenu::GetItem() {
	return item;
}

std::string LoadMenu::GetMyName() {
	return Myname;
}

